<?php
    require_once ('classes/user.class.php');
    if(session_id()=="") session_start ();
    
    if(isset($_SESSION['user']) && $_SESSION['user']->isAdmin()){
        if(!isset($_GET['manage'])){
?>

<script type="text/javascript" src="./js/manage_functions.js"></script>

<div class="page_content">
<br/><br/><br/>
<ul>
    <li>
        Administrer le site
        <ul>
            <li><a href="index.php?page=manage&manage=add_news">Ajouter une news</a></li>
        </ul>
    </li>
    <li>
        Gérer les utilisateurs
        <ul>
            <li><a href="index.php?page=manage&manage=manage_user_rights">Gérer le statut d'un utilisateur</a></li>
            <li><a href="index.php?page=manage&manage=delete">Désactiver/Supprimer un compte utilisateur</a></li>
            <li><a href="index.php?page=manage&manage=message">Envoyer un message groupé</a></li>
        </ul>
    </li>
</ul>
<?php
        }else{
            //includre header ?
            echo "<br/><h1>Interface d'Administration</h1><br/>";
            echo "<a href='index.php?page=manage'> << Menu Principal</a><br/><br/>";
            switch($_GET['manage']){
                
                case 'add_news':
                    include 'manage/add_news.php';
                    break;
                case 'manage_user_rights':
                    include 'manage/manage_user_rights.php';
                    break;
                case 'delete':
                    include 'manage/manage_user_account.php';
                    break;
                case 'message':
                    include 'manage/message_group.php';
                    break;
                    
                
            }
            
            //inclure footer ?
        }
    }else{
        echo "<span class='warning'> Vous n'êtes pas autorisé à acceder à l'interface d'administration.</span>";
    }
?>
</div>
